{ 
open Scanner_TableProTest

}
let digit = ['0'-'9']
let comma = [',']
let semicolon = [';']
let colon = [':']
let dot = ['.']
let exp = ['e''E']
let signednumber = ['-''+']?['0'-'9']*['.']['0'-'9']+
let signedint = ['-''+']?['0'-'9']*
let alphanum = ['a'-'z' 'A'-'Z' '0'-'9']
let alpha = ['a'-'z' 'A'-'Z']
let numType = "num"
let strType = "str"
let rowType = "row"
let colType = "col"
let add = '+'
let subtract = '-'
let times = '*'
let divide = '/'
let equal = '='
let lessThan = '<'
let greaterThan = '>'
let equality =  "=="
let commentStart = '?'
let newLine = '\n' | '\r'
let if = "if"
let else = "else"
let leftParan = '('
let rightParan = ')'
let leftSqParan = '['
let rightSqParan = ']'
let blockBegin = '{'
let blockEnd = '}'
let loop = "loop"
let function = "function"
let size = "size"
let currIndex = "currIndex"
let col_heading = "col_heading"
let row_heading = "row_heading"
let row_limit = "row_limit"
let col_limit = "col_limit"
let col_sort_index = "col_sort_index"
let row_filter_condition = "row_filter_condition"
let return = "return"

rule token =
parse    |  [' ' '\t' '\r' '\n'] { token lexbuf }
        |  signednumber  as n { NUMBER(float_of_string n) }
        |  digit+ as i { INTCONST (int_of_string i) }
        |  numType colon {NUMTYPE}
        |  strType colon {STRTYPE}
        |  rowType colon {ROWTYPE}
        |  colType colon {COLTYPE}
        |  add {ADD}
        |  subtract {SUBTRACT}
        |  times {MULTIPLY}
        | divide {DIVIDE}
        | lessThan {LESSTHAN}
        | greaterThan {GREATERTHAN}
        | equal {ASSIGN}
        | equality {EQUALS}
	|  commentStart {comment lexbuf}
	|  size {SIZE}
	|  currIndex {CURRINDEX}
	|  if {IF}
	|  else {ELSE}
	|  leftParan {LEFTPARAN}
	|  rightParan {RIGHTPARAN}
	|  leftSqParan {LEFTSQPARAN}
	|  rightSqParan {LEFTPARAN}
	|  blockBegin {BLOCKBEGIN}
	|  blockEnd {BLOCKEND}
	|  loop {LOOP}
	| function {FUNCTION}
	| col_heading {COL_HEADING}
	| row_heading {ROW_HEADING}
	| row_limit {ROW_LIMIT}
	| col_limit {COL_LIMIT}
	| row_filter_condition {ROW_FILTER_CONDITION}
	| col_sort_index {COL_SORT_INDEX}
	| return {RETURN}	
        |  alpha (alphanum)* as name {IDENTIFIER(name)}	
	| eof { raise End_of_file }
	| _ as char { raise (Failure("illegal character " ^Char.escaped char)) } 
and comment = parse
'\n'  { token lexbuf } (* End of comment *)
| _ { comment lexbuf } (* Eat everything else *)	

{

}
